window.onload = function () {
    let vue = new Vue({
        el: '#my-div',
        data: {
            list: [],
            flag: false,
        },
        methods: {
            find: function () {
                doPost({
                    url: 'developer/redis/query_all_redis',
                    data: {},
                    callback: function (res) {
                        if (res.data.code === 1) {
                            vue.list = res.data.data;
                            $('#table-main')[0].style.visibility = 'visible';
                        } else {
                            console.log(res);
                        }
                    }
                });
            },

            deleteKey: function (key) {
                window.parent.showConfirm('操作提示', '是否要删除所选key?', function () {
                    doPost({
                        url: 'developer/redis/delete_key',
                        data: {
                            key: key,
                        },
                        callback: function (res) {
                            if (res.data.code === 1) {
                                vue.find();
                                window.parent.showSuccess();
                            } else {
                                window.parent.showInfo(res.data.msg);
                            }
                        }
                    });
                });

            },
            delclass: function (idd) {
                if (!vue.flag) {
                    $('.table tbody tr:eq(' + idd + ') td:nth-child(2) p').removeClass('values');
                    vue.flag = true;
                } else {
                    $('.table tbody tr:eq(' + idd + ') td:nth-child(2) p').addClass('values');
                    vue.flag = false;
                }
            }
        },
    });

    vue.find();
};